package cn.signalpha.modules.base.service;

import cn.signalpha.core.mp.base.BaseServiceImpl;
import cn.signalpha.modules.base.entity.Contact;
import cn.signalpha.modules.base.mapper.ContactMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

import static cn.signalpha.common.cache.CacheNames.CONTACT_KEY;

/**
 * 服务类
 *
 * @author signalpha
 */
@Service
public class ContactService extends BaseServiceImpl<ContactMapper, Contact> {

	@Cacheable(cacheNames = CONTACT_KEY)
	public List<Contact> listCache() {
		return list(Wrappers.<Contact>lambdaQuery().orderByDesc(Contact::getSort));
	}

	@CacheEvict(cacheNames = CONTACT_KEY, allEntries = true)
	public void removeCaChe() {
	}

}

